cmake_minimum_required(VERSION 2.8)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
find_package(LibEvent)

include_directories(${LIBEVENT_INCLUDE_DIR})

set(NETBASE_SOURCES
  connector.h
  connector.cc
  exception.h
  exception.cc
  listener.cc
  listener.h
  netbase.h
  netbase.cc
  tcp_session.h
  tcp_session.cc
  util.h
  util.cc
  )

add_library(netbase SHARED ${NETBASE_SOURCES})
set_target_properties(netbase PROPERTIES
  COMPILE_FLAGS "-std=c++0x -Wall"
  )
target_link_libraries(netbase 
  ${LIBEVENT_LIB}
  pthread
  )

install(TARGETS netbase LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/bin)

include_directories(${CMAKE_CURRENT_LIST_DIR})
add_subdirectory(tests)

